/*
 * @Author: 一路向阳 tt_sunzhenfeng@163.com
 * @Date: 2024-05-14 12:27:42
 * @LastEditors: 一路向阳 tt_sunzhenfeng@163.com
 * @LastEditTime: 2024-05-14 12:35:41
 * @FilePath: \nest-demo\src\manager\manager.service.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { Injectable } from '@nestjs/common';
import { CreateManagerDto } from './dto/create-manager.dto';
import { Observable } from 'rxjs';

@Injectable()
export class ManagerService {
  create(createManagerDto: CreateManagerDto) {
    // Observable 发布可观察的任务
    // subscribe 订阅任务
    const observable = new Observable((subscriber) => {
      subscriber.next(1);
      subscriber.next(2);
      subscriber.next(3);
      setTimeout(() => {
        subscriber.next(4);
        subscriber.complete();
      }, 1000);
    });
    observable.subscribe({
      next: (value) => {
        console.log(value);
      },
    });
    //interval 操作符：不停⽣成值的操作符
    // take 操作符：限制⽣成值的数量
    // of 操作符：⾃定义数据
    return 'This action adds a new manager';
  }
}
